package com.haizhi.crm.api.controller.achievement;

import com.haizhi.crm.biz.constant.AchievementType;
import com.haizhi.crm.biz.service.AchievementService;
import com.haizhi.crm.common.model.Response;
import com.haizhi.crm.sys.auth.model.UserQo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangshan on 2018/6/7.
 */
@Api(description = "[业务-业绩]业绩增删改查" )
@RestController
@RequestMapping("/achievement" )
public class AchievementController {

    @Autowired
    private AchievementService achievementService;


    @ApiOperation(value = "获取开户信息", notes = "输入：userId" )
    @GetMapping("/open" )
    public Response open(@ModelAttribute UserQo userQo) {
        return Response.success(achievementService.findDetail(userQo.getUserId(), AchievementType.OPEN));
    }


    @ApiOperation(value = "获取存款信息", notes = "输入：userId" )
    @GetMapping("/deposit" )
    public Response deposit(@ModelAttribute UserQo userQo) {
        return Response.success(achievementService.findDetail(userQo.getUserId(), AchievementType.DEPOSIT));
    }

    @ApiOperation(value = "获取贷款信息", notes = "输入：userId" )
    @GetMapping("/loan" )
    public Response loan(@ModelAttribute UserQo userQo) {
        return Response.success(achievementService.findDetail(userQo.getUserId(), AchievementType.LOAN));
    }

}
